package com.example.lizhanqi.livevideo.utils;

import android.content.Context;
import android.util.DisplayMetrics;
import android.view.WindowManager;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by Lizhanqi on 2016/9/16 0016.
 */
public class PhoneUtils {
    /*手机号判断*/
    public static boolean isPhoneNumber(String number) {
        String REGEX_MOBILE_SIMPLE = "^[1]\\d{10}$";
        //把正则表达式的规则编译成模板
        Pattern pattern = Pattern.compile(REGEX_MOBILE_SIMPLE);
        Matcher matcher = pattern.matcher(number);
        return matcher.find();
    }
    public static int GetScreenWidth(Context context){
        DisplayMetrics displayMetrics = new DisplayMetrics();
        WindowManager    wm = (WindowManager) context.getSystemService(context.WINDOW_SERVICE);
        wm.getDefaultDisplay().getMetrics(displayMetrics);
        return displayMetrics.widthPixels;
    }
    public static  int GetScreenHeight(Context context){
        DisplayMetrics displayMetrics = new DisplayMetrics();
        WindowManager   wm = (WindowManager) context.getSystemService(context.WINDOW_SERVICE);
        wm.getDefaultDisplay().getMetrics(displayMetrics);
        return displayMetrics.heightPixels;
    }

}
